<template>
  <view class="container">

<!--    <filterDropdown-->
<!--        class="fixed-dropdown"-->
<!--        :menuTop="0"-->
<!--        :filterData="filterData"-->
<!--        :defaultSelected="defaultSelected"-->
<!--        :updateMenuName="true"-->
<!--        @confirm="confirm"-->
<!--        dataFormat="Object">-->
<!--    </filterDropdown>-->



    <!-- 顶部搜索栏 -->
    <view class="search-bar">
      <view class="search-left">
        <image src="/static/arrow-left.png" mode="aspectFit"></image>
      </view>
      <view class="search-input">
        <input type="text" placeholder="请输入小区或商圈名" />
      </view>
      <view class="search-right">
        <view class="chat-icon">
          <image src="/static/chat-icon.png" mode="aspectFit"></image>
          <view class="chat-badge">3</view>
        </view>
      </view>
    </view>

    <!-- 小区列表 -->
    <view class="community-list">
      <view class="community-item" v-for="(item, index) in communityList" :key="index" @click="goToAreaDetail(item)">
        <view class="item-thumb">
          <view class="img-status">图片拍摄中</view>
          <image src="/static/community-placeholder.png" mode="aspectFill"></image>
        </view>
        <view class="item-content">
          <view class="item-title">{{ item.name }}</view>
          <view class="item-desc">
            {{ item.desc }}<br />
            <text v-if="item.sell">在售{{ item.sell }}套</text>
            <text v-if="item.rent">/在租{{ item.rent }}套</text>
          </view>
          <view class="item-price">
            <text v-if="item.price">{{ item.price }}元/平</text>
            <text v-else>暂无数据</text>
          </view>
        </view>
        <view class="item-favor">
          <image
              :src="item.isFavor ? '/static/heart-red.png' : '/static/heart-gray.png'"
              mode="aspectFit"
          ></image>
        </view>
      </view>
    </view>

    <!-- 地图图标 -->
    <view class="map-icon">
      <image src="/static/map-pin.png" mode="aspectFit"></image>
    </view>
  </view>
</template>

<script>
// import searchData from '@/common/utils/searchData.js';//筛选菜单数据
//import filterDropdown from '@/components/zy/filterDropdown.vue';
export default {
  // components: {
  //   filterDropdown
  // },
  data() {
    return {
      filterData:[],
      defaultSelected: [],
      communityList: [
        {
          name: "上高山水间",
          desc: "上高市古城/塔楼 板楼 塔板结合 平房/...",
          sell: 118,
          rent: 63,
          price: 25018,
          isFavor: true
        },
        {
          name: "上高农校宿舍",
          desc: "上高市古城/板楼 平房/2000-2014年",
          sell: 2,
          rent: 1,
          price: 13563,
          isFavor: false
        },
        {
          name: "文笔街",
          desc: "上高市古城/板楼 塔板结合/2003-2012...",
          sell: 1,
          price: 14717,
          isFavor: false
        },
        {
          name: "无为小区",
          desc: "上高市古城/板楼/2009年",
          sell: 1,
          isFavor: false
        },
        {
          name: "银泉小区",
          desc: "上高市古城/板楼/2010年",
          sell: 3,
          isFavor: false
        }
      ]
    };
  },
  onLoad(){
    //this.filterData = searchData;
  },
  methods: {
    goToAreaDetail(area) {
      uni.navigateTo({
        url: `/pages/house/areaDetail`
      });
    }
  }
};
</script>

<style>
.container {
  background-color: #f7f7f7;
}

.search-bar {
  display: flex;
  align-items: center;
  padding: 20rpx 15rpx;
  background-color: #fff;
  margin-bottom: 20rpx;
}

.search-left {
  width: 60rpx;
  height: 60rpx;
}

.search-input {
  flex: 1;
  height: 80rpx;
  background-color: #f7f7f7;
  border-radius: 15rpx;
  padding: 0 30rpx;
}

.search-right {
  width: 80rpx;
  height: 80rpx;
  margin-left: 20rpx;
}

.chat-icon {
  position: relative;
}

.chat-badge {
  position: absolute;
  top: -10rpx;
  right: -10rpx;
  width: 24rpx;
  height: 24rpx;
  background-color: #ff4444;
  color: #fff;
  font-size: 18rpx;
  text-align: center;
  line-height: 24rpx;
  border-radius: 50%;
}

.filter-bar {
  display: flex;
  margin-bottom: 20rpx;
}

.filter-item {
  flex: 1;
  text-align: center;
  padding: 15rpx;
  background-color: #fff;
  margin-right: 10rpx;
  border-radius: 10rpx;
}

.rank-banner {
  display: flex;
  align-items: center;
  padding: 20rpx;
  background-color: #fff9eb;
  margin-bottom: 20rpx;
  border-radius: 10rpx;
}

.rank-icon {
  width: 40rpx;
  height: 40rpx;
  margin-right: 15rpx;
}

.rank-text {
  flex: 1;
  color: #333;
  font-size: 32rpx;
}

.rank-arrow {
  width: 30rpx;
  height: 30rpx;
}

.community-list {
  margin-bottom: 120rpx;
}

.community-item {
  display: flex;
  align-items: flex-start;
  padding: 20rpx;
  background-color: #fff;
  margin-bottom: 15rpx;
  border-radius: 10rpx;
}

.item-thumb {
  width: 200rpx;
  height: 140rpx;
  margin-right: 20rpx;
  position: relative;
}

.item-thumb image {
  width: 100%;
  height: 100%;
  border-radius: 10rpx;
}

.img-status {
  position: absolute;
  top: 10rpx;
  left: 10rpx;
  padding: 5rpx 15rpx;
  background-color: rgba(0, 0, 0, 0.6);
  color: #fff;
  border-radius: 5rpx;
  font-size: 28rpx;
}

.item-content {
  flex: 1;
}

.item-title {
  font-size: 34rpx;
  font-weight: bold;
  margin-bottom: 10rpx;
}

.item-desc {
  color: #666;
  font-size: 28rpx;
  line-height: 1.4;
  margin-bottom: 10rpx;
}

.item-price {
  color: #ff4444;
  font-size: 34rpx;
}

.item-favor {
  width: 80rpx;
  height: 80rpx;
}

.map-icon {
  position: fixed;
  bottom: 30rpx;
  right: 30rpx;
  width: 120rpx;
  height: 120rpx;
  background-color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
}

.map-icon image {
  width: 60rpx;
  height: 60rpx;
}

.sticky-filter {
  position: sticky;
  top: 100px; /* 根据需要调整吸顶位置 */
  z-index: 1000;
}
</style>